import { request } from '@/utils/request'

// 销售统计
export function getSalesStatistics(params: {
  salespersonId?: number
  date?: string
  year?: number
  statisticsType?: string
}) {
  return request<{
    totalSalesAmount: number
    completedCustomerCount: number
    completedOrderCount: number
    refundedOrderCount: number
    totalOrderCount: number
    successRate: number
    timeSeriesData: Array<{
      timeLabel: string
      salesAmount: number
      orderCount: number
    }>
    salespersonData: Array<{
      salespersonId: number
      salespersonName: string
      salesAmount: number
      orderCount: number
    }>
  }>({
    url: '/sales-statistics',
    method: 'get',
    params
  })
}

